Skip to content

[docs] Plan progressive tool disclosure for the playground build kit#5405

Open
ashrafchowdury wants to merge 1 commit into
mainfrom
doc/planing-to-improve-the-internal-tool-manage
Open

[docs] Plan progressive tool disclosure for the playground build kit#5405
ashrafchowdury wants to merge 1 commit into
mainfrom
doc/planing-to-improve-the-internal-tool-manage

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Context

Open a playground agent that shows "Tools: None", type "hi", and the turn costs about 15K
prompt tokens. The cost is the build kit: it advertises roughly 13 platform-op tool schemas to
the model on every turn, before the model has done anything. Two of those schemas
(commit_revision and test_run) each embed the full ~5.5K-token agent-template schema, which
is about 11K of the 15K on its own. The same always-on tools also hurt reliability; the
internal-tools review found that extra visible tools become "wander targets" that derail runs.

Skills already avoid this. They live on disk, put only their name and description in the
prompt, and load the body on demand. The platform ops never got the same treatment.

What this adds

A planning workspace only. No code and no runtime change. It captures the problem, the current
wiring (grounded in file:line), a proposed design, and a sliced plan, so the team can agree on
the approach before anyone writes code.

The proposed approach: advertise a small discovery meta-toolset instead of the full op schemas,
and load a schema only when the model asks for it.

Before (every turn):
13 platform ops, each a full {name, description, inputSchema} in the prompt. ~15K tokens.

After (the design):
2 tools in the prompt. agenta_ops() lists what the agent can do (op name + one line, no
schemas). agenta_op(op, args) fetches one op's schema on demand, then runs it. A no-op turn
pays a low-hundreds constant and stays flat as the catalog grows.

The op specs stay resolved and private in the runner's memory, so execution does not change.
The invoker feeds the target op's private call descriptor into the same direct-call path, which
keeps the self-targeting $ctx bindings, the SSRF guard, and the per-op approval gate exactly as
they are today.

Files, under docs/design/agent-workflows/projects/progressive-tool-disclosure/:

  • README.md (index + locked decisions)
  • context.md (problem, scope, non-goals, success criteria)
  • research.md (current advertise/execute path with file:line, the numbered seams)
  • design.md (the meta-toolset, the execution and permission path, alternatives)
  • plan.md (four slices: baseline, schema diet, mechanism, measure)
  • status.md (locked decisions, open questions, next action)

For reviewers

The point of a plan-only PR is to settle these before code. Full detail in status.md:

  1. Invoker shape: one agenta_op with a describe/execute mode, or two tools? (rec: one)
  2. Permission: gate agenta_op on the target op's private spec, not on the invoker, so writes
    keep their approval prompt. (rec: yes)
  3. Catalog summary: build it runner-side from resolved specs, or thread it from the op catalog.
    (rec: runner-side)
  4. Eligibility: a heuristic (collapse all direct-call specs) or a source:"platform" wire marker.
    (rec: heuristic for the flagged POC, marker before default-on)
  5. Sequencing: ship the schema diet first as its own slice (~11K at near-zero risk)? (rec: yes)
  6. Default-on criteria: what token and pass-rate target flips the flag? (needs a team number)

Notes

Docs only; nothing to run. The token numbers come from the 2026-07-17 investigation and are
flagged for a re-baseline in the first slice. The design is verified against the current runner
code; the seam is advertisedToolSpecs() in services/runner/src/tools/public-spec.ts, consumed at
pi-assets.ts and environment.ts.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 20, 2026
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 20, 2026 11:56am

Request Review

@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Jul 20, 2026
@ashrafchowdury
ashrafchowdury requested a review from mmabrouk July 20, 2026 11:56
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added design documentation for progressive tool disclosure in agent workflows.
    • Describes a discovery-based approach to reduce initial prompt token usage while preserving tool execution and approval behavior.
    • Documents scope, research findings, proposed design, phased implementation plan, success criteria, and current planning status.
    • Records open questions, measurement goals, and areas explicitly outside the project scope.

Walkthrough

This PR adds planning documentation for progressive tool disclosure in the playground build kit. It defines the runner advertisement seam, two discovery meta-tools, execution and permission invariants, staged rollout, measurement, schema-diet work, scope boundaries, and implementation questions. No implementation changes are included.

Changes

Progressive tool disclosure

Layer / File(s) Summary
Architecture and scope
docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md, context.md, research.md, status.md
Documents the current advertisement and execution flow, disclosure terminology, token-cost observations, shared Pi/Claude consumers, locked decisions, and open implementation questions.
Discovery and execution design
docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
Defines the agenta_ops catalog tool and agenta_op describe/execute tool, including eligibility detection, private spec retention, permission checks, and direct-call execution.
Flagged rollout and measurement
docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
Specifies baseline measurement, schema simplification for commit_revision and test_run, flagged integration and tests, follow-up evaluation, and excluded work.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Agenta-AI/agenta#5060 — Related to the planned test_run schema-diet work through its platform operation contract.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the docs-only planning work for progressive tool disclosure in the playground build kit.
Description check ✅ Passed The description directly matches the docs-only planning workspace and proposed progressive tool disclosure design.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch doc/planing-to-improve-the-internal-tool-manage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cd91cd3-59eb-49de-9205-786764ff4f1d

📥 Commits

Reviewing files that changed from the base of the PR and between 3588f13 and 0db3f6d.

📒 Files selected for processing (6)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/status.md

Comment on lines +74 to +75
5. Cost of laziness is bounded: ≤1 extra round-trip per distinct op used; a schema fetched at
most once per op per conversation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Define and schedule the required schema cache.

The context makes “at most once per op per conversation” a success criterion, but the design only calls caching optional and the plan assigns no implementation, ownership, lifecycle, or test.

  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md#L74-L75: retain the bound as an explicit acceptance criterion.
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md#L97-L101: specify cache ownership, invalidation, and cold-replay behavior.
📍 Affects 2 files
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md#L74-L75 (this comment)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md#L97-L101

Comment on lines +11 to +13
- **`agenta_ops(query?)`** — returns the op catalog as a compact list: `{op, one_line,
read_only}` per op, no input schemas. Optional `query` filters. A few hundred tokens, flat,
regardless of catalog size. This is the "what can I do on the platform" index.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Bound the agenta_ops result; it cannot be flat with catalog size.

Returning one entry per operation is O(n), so the result grows as the catalog grows. Define pagination, a hard limit, or bounded query semantics, and change “flat regardless of catalog size” to describe only the advertised prompt cost.

Comment on lines +54 to +60
A platform op is a `callback`-kind spec with a direct `call`; so is a `reference` (workflow)
tool. There is no explicit marker today (research seam 5). Two options:

- **Heuristic (zero wire change).** Collapse every direct-`call` callback spec into the
meta-toolset; leave builtins, `client`, `code`, `gateway` (callRef), and MCP advertised as-is.
The playground overlay only injects platform ops (+ the two client tools), so this covers the
measured cost. Risk: an author who added a `reference` tool would see it disclosed too. Fine for

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

The eligibility contract does not cover all platform operation specs.

The resolver emits handler-mode platform operations with call_ref and endpoint-mode operations with direct call; a direct-call-only heuristic therefore leaves part of the platform-op set advertised and can fail the planned advertisement test.

  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md#L54-L60: include both representations or require the platform source marker.
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md#L95-L100: correct the platform eligibility description.
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/status.md#L36-L38: revise the POC recommendation or narrow its scope.
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md#L40-L50: align Slice 2 behavior and tests with the chosen eligibility contract.
📍 Affects 4 files
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md#L54-L60 (this comment)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md#L95-L100
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/status.md#L36-L38
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md#L40-L50

Comment on lines +38 to +42
A playground author opens an agent and types a message. The model sees two small platform tools
(`agenta_ops` to list what it can do, `agenta_op` to fetch a schema and act) instead of a wall
of op schemas. A no-op turn costs a low-hundreds token constant instead of ~15K, and stays flat
as the catalog grows. Every op still runs with its exact self-targeting binding and approval
gate. Builds are cheaper and, per the internal-tools review, more reliable.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

State approval parity as a requirement, not an achieved guarantee.

The README says every operation still has its exact approval gate, but design.md and status.md identify target-spec permission gating as an unresolved implementation requirement. Reword this as an acceptance criterion until the per-operation approval tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant